import _fetch from './request'

function articlesTechnic (params) {
  return _fetch({
    url: '/articles/technic',
    params
  })
}

function chartHot () {
  return _fetch({
    url: '/chart-data/hot'
  })
}

function articlesShare (params) {
  return _fetch({
    url: '/articles/share',
    params
  })
}
// 大家都在搜索
function articlesShareTopSearch () {
  return _fetch({
    url: '/articles/shareTopSearch'
  })
}

// 文章
function articlesShareId (id) {
  return _fetch({
    url: '/articles/share/' + id
  })
}

// 评论
function articlesCommentsId (params, id) {
  return _fetch({
    url: '/articles/comments/' + id,
    params
  })
}

// 发表回复评论,需要登录
function articlesComments (data) {
  return _fetch({
    url: '/articles/comments',
    method: 'post',
    needToken: true,
    data
  })
}
//  点赞
function articleStar (data) {
  return _fetch({
    url: '/articles/star',
    method: 'post',
    needToken: true,
    data
  })
}

//  收藏
function articlesCollect (data) {
  return _fetch({
    url: '/articles/collect',
    method: 'post',
    needToken: true,
    data
  })
}

// 面经里的点赞
function articleCommentsStar (data) {
  return _fetch({
    url: '/article-comments/star',
    method: 'post',
    needToken: true,
    data
  })
}

// 导出
export {
  articlesTechnic,
  chartHot,
  articlesShare,
  articlesShareTopSearch,
  articlesShareId,
  articlesCommentsId,
  articlesComments,
  articleStar,
  articlesCollect,
  articleCommentsStar
}
